<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
</head>

<body>
https://www.layuion.com/doc/
<div class="layui-body">
    <!-- 内容主体区域 -->
    <table class="layui-hide" id="demotable">
    </table>
</div>
<script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
<script>
    //JavaScript代码区域

    layui.use('table', function(){
        var table = layui.table;
        //展示异步数据
        table.render({
            elem: '#demotable'
            ,url: '/addProducts2'
            //,skin: 'line' //表格风格
            ,even: true
            ,page: true //是否显示分页
            ,cols: [
                [ //标题栏
                    {field: 'proId', title: 'id'}
                    ,{field: 'proName', title: '名称'}
                ]
            ]
            ,limit: 5   //默认值
            ,limits: [1, 5, 10] //设置每页显示几条
        });
    });

</script>
</body>
</html>